(function () {
    var list = document.querySelector('.list')

    function cloneNode() {
        var firstNode = list.children[0]
        var newNode = firstNode.cloneNode(true) //true 表示复制节点里的内容
        list.appendChild(newNode)
    }
    cloneNode()

    var duration = 2000
    setInterval(move, duration);

    var curIndex = 0,
        itemHeight = 20;

    function move() {
        var form = curIndex * itemHeight
        curIndex++
        var to = curIndex * itemHeight,
            totalMiunt = 500,
            duration = 10,
            mines = totalMiunt / duration,
            dis = (to - form) / mines;
        console.log(dis);
        var timerId = setInterval(() => {
            form += dis
            if (form >= to) {
                if (curIndex === list.children.length -1) {
                    curIndex = 0
                    // form = 0
                }
                clearInterval(timerId)
            }
            list.scrollTop = form
        }, duration);

    }
})()